/**
 * 
 */
package org.compiere.model;

import java.sql.ResultSet;
import java.util.Properties;

/**
 * @author V.Sokolov
 *
 */
public class Mhrmbusinesstriplinelist extends X_hrm_businesstrip_line_list {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 6002665617815477378L;

	/**
	 * @param ctx
	 */
	public Mhrmbusinesstriplinelist(Properties ctx) {
		super(ctx);
	}

	/**
	 * @param ctx
	 * @param hrm_businesstrip_line_list_ID
	 * @param trxName
	 */
	public Mhrmbusinesstriplinelist(Properties ctx,
			int hrm_businesstrip_line_list_ID, String trxName) {
		super(ctx, hrm_businesstrip_line_list_ID, trxName);
	}

	/**
	 * @param ctx
	 * @param rs
	 * @param trxName
	 */
	public Mhrmbusinesstriplinelist(Properties ctx, ResultSet rs, String trxName) {
		super(ctx, rs, trxName);
	}

	/* 
	 */
	@Override
	protected boolean afterSave(boolean newRecord, boolean success) {
		
		Mhrmbusinesstripline bline = new Mhrmbusinesstripline(getCtx(), gethrm_businesstrip_line_ID(), get_TrxName());
		if(newRecord){
			bline.sethrm_total(bline.gethrm_total().add(gethrm_total()));
			bline.saveEx();
		}		
		
		return success;
	}
	
	/* 
	 */
	@Override
	protected boolean afterDelete(boolean success) {
		
		Mhrmbusinesstripline bline = new Mhrmbusinesstripline(getCtx(), gethrm_businesstrip_line_ID(), get_TrxName());
		bline.sethrm_total(bline.gethrm_total().add(gethrm_total().negate()));
		bline.saveEx();
		
		return success;
	}
}
